<template>
	<view class="container">
		<view class="item" v-for="(item, index) in items" :key="index" @tap="goToItem(item.id)">
			<text>社区名称:{{ item.communityName }}</text>
			<text>联系人:{{ item.contacts }}</text>
			<text>电话:{{ item.telephone }}</text>
			<text>地址:{{ item.showAddress }}</text>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			items: []
		};
	},
	onLoad() {
		this.$http
			.request({
				url: 'api/Community/GetCommunities'
			})
			.then(res => {
				// #ifdef H5
				this.$wechat.hideMenu();
				// #endif
				this.items = res;
			});
	},
	methods: {
		goToItem(id) {
			uni.navigateTo({
				url: 'center?communityId=' + id
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.container {
	background: $uni-bg-color-grey;
	padding-bottom: 10rpx;
}
.item {
	display: flex;
	flex-direction: column;
	width: 90%;
	margin: 0 auto;
	background: #ffffff;
	padding: 20rpx;
	border-radius: 15rpx;
	line-height: 50rpx;
	margin-bottom: 20rpx;
}
</style>
